# Variables
set $meta Mod4

# Input configuration
# TODO: Create a spot for trackpad and mouse config, also how can I have this target the keyboard?
input * {
    xkb_layout us
    xkb_numlock enable
}

# Move floating windows with [META] + mouse 1 and resize with [META] + mouse 2
floating_modifier $meta normal

# Shortcuts for important applications
bindsym {
    $meta+t     exec $term
    $meta+b     exec $browser
    $meta+Enter exec $menu
    $meta+s     exec $screenshot
}

bindsym $meta+r       reload # Reloads sway config
bindsym $meta+Escape  exec $lock # Lock system
bindsym $meta+Delete kill bindsym # Kills selected window

# Notification control
bindsym {
    $meta+d         exec makoctl dismiss
    Control+$meta+d exec makoctl dismiss --all
}

# Media and audio control
bindsym { # --locked 
    XF86AudioRaiseVolume exec --no-startup-id pamixer -i 5 # Look into amixer
    XF86AudioLowerVolume exec --no-startup-id pamixer -d 5
    XF86AudioMute        exec --no-startup-id pamixer -t
    XF86AudioNext        exec playerctl next
    XF86AudioPrev        exec playerctl previous
    XF86AudioPlay        exec playerctl play-pause
}

# Brightness controls
bindsym { # --locked
    XF86MonBrightnessUp   exec light -S "$(light -G | awk '{ print int(($1 + .72) * 1.4) }')" # Make this a variable
    XF86MonBrightnessDown exec light -S "$(light -G | awk '{ print int($1 / 1.4) }')"
}

# Move your focus around
bindsym { 
    $meta+Up    focus up
    $meta+Left  focus left
    $meta+Down  focus down
    $meta+Right focus right
    # Same but with vim like binds
    $meta+k focus up
    $meta+h focus left
    $meta+j focus down
    $meta+l focus right
}


# Move the focused window with the same, but add Shift
bindsym $mod+Alt+Left move left
bindsym $mod+Alt+Down move down
bindsym $mod+Alt+Up move up
bindsym $mod+Alt+Right move right

# Same but with vim like binds
bindsym $mod+Alt+h move left
bindsym $mod+Alt+j move down
bindsym $mod+Alt+k move up
bindsym $mod+Alt+l move right

# switch to workspace
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2
bindsym $mod+3 workspace $ws3
bindsym $mod+4 workspace $ws4
bindsym $mod+5 workspace $ws5
bindsym $mod+6 workspace $ws6
bindsym $mod+7 workspace $ws7
bindsym $mod+8 workspace $ws8
bindsym $mod+9 workspace $ws9
bindsym $mod+0 workspace $ws10

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace $ws1
bindsym $mod+Shift+2 move container to workspace $ws2
bindsym $mod+Shift+3 move container to workspace $ws3
bindsym $mod+Shift+4 move container to workspace $ws4
bindsym $mod+Shift+5 move container to workspace $ws5
bindsym $mod+Shift+6 move container to workspace $ws6
bindsym $mod+Shift+7 move container to workspace $ws7
bindsym $mod+Shift+8 move container to workspace $ws8
bindsym $mod+Shift+9 move container to workspace $ws9
bindsym $mod+Shift+0 move container to workspace $ws10

# Switch the current workspace between different layout styles
bindsym $mod+o layout stacking
bindsym $mod+p layout toggle split

# Make the current focus fullscreen
bindsym $mod+f fullscreen

# Toggle the current focus between tiling and floating mode
bindsym $mod+space floating toggle

# Swap focus between the tiling area and the floating area
bindsym $mod+Ctrl+space focus mode_toggle

# move focus to the parent window
bindsym $mod+a focus parent

# Modes
mode "resize" {
    bindsym Left resize shrink width 25px
    bindsym Up resize shrink height 25px
    bindsym Down resize grow height 25px
    bindsym Right resize grow width 25px

    # return to default mode
    bindsym Return mode "default"
    bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"

exec_always ~/.config/waybar/launch.sh
